<template>
  <view class="search-box">
    <!-- #ifndef MP-WEIXIN -->
    <uni-icons styleOther="margin-top: 5rpx;" @click="goBack" type="left" size="31"></uni-icons>
    <!-- #endif -->
    <uni-easyinput styleOther="margin: 10rpx 0;border-radius: 25rpx;"  class="uni-mt-5" suffixIcon="search" v-model="grope" placeholder="请输入荣誉名称" @iconClick="onSearch"></uni-easyinput>
  </view>
</template>

<script setup>
import { defineEmits, ref, defineProps,onMounted } from "vue";

const props = defineProps({
  title: {
    type: String,
    default: "搜索",
  },
  getSearchName:{
    type:String,
    default:""
  }
});
const grope = ref("");
const emit = defineEmits(["on-search"]);
function goBack() {
  uni.navigateBack({
    delta: 1, // 返回的页面数，这里表示返回上一页
  });
}
function alteration(value) {
  console.log(value);
  // grope.value= event.mp.detail
}
function onSearch() {
  // console.log(grope.value);
  emit("on-search", grope.value);
}
onMounted(()=>{
  grope.value=props.getSearchName
})
</script>

<style scoped lang="less">
.search-box {
  position: sticky;top: 0rpx;
  background-color: #f7f8fd;
  display: flex;
  align-items: center;
  /* #ifdef MP-WEIXIN */
  padding: 0 20rpx;
  /* #endif */
  margin-bottom: 20rpx;
  .icon-title {
    color: #272636;
    font-family: "ali-m";
  }
}
</style>
